// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import Mint from 'mint-ui'
import App from './App'
import router from './router'
import vueResource from 'vue-resource'
import VueScroller from 'vue-scroller'
import store from './store'
import axios from 'axios'
import Loading from 'components/loading/index.js'
import VueLazyload from 'vue-lazyload'

Vue.config.productionTip = false

Vue.use(Mint);
Vue.use(vueResource);
Vue.use(VueScroller);

Vue.use(Loading);
Vue.use(VueLazyload, {
  loading: require('./assets/default.png')
})
axios.interceptors.request.use(function (config) {  //配置发送请求的信息
  store.dispatch('showLoading')  
  return config;
}, function (error) {
  return Promise.reject(error);
});

axios.interceptors.response.use(function (response) { //配置请求回来的信息
  store.dispatch('hideLoading')
  return response;
}, function (error) {

  return Promise.reject(error);
});


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})
